home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
ISSUE18
/
SURVIVE
/
FMPASSWD.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-11-18
|
1KB
|
69 lines
unit fmPasswd;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TdlgPassword = class(TForm)
edtOldPassword: TEdit;
edtNewPassword: TEdit;
edtConfirmPassword: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
btnOK: TButton;
btnCancel: TButton;
procedure btnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
public
end;
var
dlgPassword: TdlgPassword;
function LaunchChangePasswordDialog: TModalResult;
function LaunchPasswordExpiredDialog: TModalResult;
implementation
{$R *.DFM}
uses
Login;
function LaunchChangePasswordDialog;
begin
dlgPassword.Caption := 'Change Password';
Result := dlgPassword.ShowModal;
end;
function LaunchPasswordExpiredDialog;
begin
dlgPassword.Caption := 'Password Expired';
Result := dlgPassword.ShowModal;
end;
procedure TdlgPassword.btnOKClick(Sender: TObject);
begin
if edtNewPassword.Text <> edtConfirmPassword.Text then
raise Exception.Create('The confirmation password is not correct.');
LoginManager.ChangePassword(edtOldPassword.Text, edtNewPassword.Text);
ModalResult := mrOK;
end;
procedure TdlgPassword.FormShow(Sender: TObject);
begin
edtOldPassword.Text := '';
edtNewPassword.Text := '';
edtConfirmPassword.Text := '';
edtOldPassword.SetFocus;
end;
end.